<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// Test Ctrl+Up/Down motion

selection_test(
    [
      '<div contenteditable style="font-family:monospace">',
        '<p>foo| bar baz qux.</p>',
        '<p>foo bar baz qux</p>',
      '</div>'
    ],
    selection => {
      assert_own_property(window, 'eventSender');
      eventSender.keyDown('ArrowUp', ['ctrlKey']);
    },
    [
      '<div contenteditable style="font-family:monospace">',
        '<p>|foo bar baz qux.</p>',
        '<p>foo bar baz qux</p>',
      '</div>'
    ]);

selection_test(
    [
      '<div contenteditable style="font-family:monospace">',
        '<p>foo| bar baz qux.</p>',
        '<p>foo bar baz qux.</p>',
      '</div>'
    ],
    selection => {
      assert_own_property(window, 'eventSender');
      eventSender.keyDown('ArrowUp', ['ctrlKey']);
      eventSender.keyDown('ArrowDown', ['ctrlKey']);
    },
    [
      '<div contenteditable style="font-family:monospace">',
        '<p>foo bar baz qux.</p>',
        '<p>foo| bar baz qux.</p>',
      '</div>'
    ]);

selection_test(
    [
      '<div contenteditable style="font-family:monospace">',
        '<p>foo bar baz qux.</p>',
        '<p>foo| bar baz qux.</p>',
      '</div>'
    ],
    selection => {
      assert_own_property(window, 'eventSender');
      eventSender.keyDown('ArrowDown', ['ctrlKey', 'shiftKey']);
    },
    [
      '<div contenteditable style="font-family:monospace">',
        '<p>foo bar baz qux.</p>',
        '<p>foo^ bar baz qux.|</p>',
      '</div>'
    ]);

selection_test(
    [
      '<div contenteditable style="font-family:monospace">',
        '<p>foo bar baz qux.</p>',
        '<p>foo| bar baz qux.</p>',
      '</div>'
    ],
    selection => {
      assert_own_property(window, 'eventSender');
      eventSender.keyDown('ArrowDown', ['ctrlKey', 'shiftKey']);
      eventSender.keyDown('ArrowUp', ['ctrlKey', 'shiftKey']);
    },
    [
      '<div contenteditable style="font-family:monospace">',
        '<p>foo| bar baz qux.</p>',
        '<p>foo^ bar baz qux.</p>',
      '</div>'
    ]);
</script>
